﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MySoftWare.BaseModel;
using MySoftWare.MVCCommon;
using MySoftWare.MVCCommon.Repository;

namespace MySoftWare.SimpleMVC.Controllers
{
    public class MenuController : Controller
    {
        //
        // GET: /Menu/
        private IMenuRepository AutoFacMenu;
        public MenuController(IMenuRepository MenuRepository)
        {
            AutoFacMenu = MenuRepository;
        }
        public ActionResult SysMenuList()
        {
            List<MenuModel> List = new List<MenuModel>();
            List = AutoFacMenu.GetSysMenuList();
            return PartialView("HeadPartialView", List);
        }

        public ActionResult ChildMenuList(string MenuID)
        {
            List<MenuModel> List = new List<MenuModel>();
            List = AutoFacMenu.GetMenuChild(MenuID);
            return PartialView("LeftPartialView", List);
        }


        #region 菜单管理
        public ActionResult MenuManage()
        {
            return View();
        }

        public ActionResult MenuListContent(string MenuID="-1")
        {
            List<TreeMenuModel> MenuList = new List<TreeMenuModel>();
            MenuList = AutoFacMenu.GetSysMenuList(int.Parse(MenuID));
            return Json(MenuList, JsonRequestBehavior.AllowGet);
        }
        #endregion

    }
}
